package com.create.vip.mall.brand.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.create.vip.mall.brand.mapper.BrandMapper;
import com.create.vip.mall.brand.model.Brand;
import com.create.vip.mall.brand.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements BrandService  {

    @Autowired
    private BrandMapper brandMapper;

    @Override
    public List<Brand> queryList(Brand brand) {
        //查询分装
        QueryWrapper<Brand> queryWapper = new QueryWrapper<>();
        queryWapper.like("name",brand);
        queryWapper.eq("initial",brand);
        return brandMapper.selectList(queryWapper);
    }

    @Override
    public Page<Brand> queryPageList(Brand brand, Long currentPage, Long size) {
        QueryWrapper<Brand> queryWapper = new QueryWrapper<>();
        queryWapper.like("name",brand);
        return brandMapper.selectPage(new Page<>(currentPage,size),queryWapper);
    }

}
